#!/usr/bin/perl -w
use strict;

##
## package: Main
## purpose: Demonstrate ComplexNumber object, including operator overloading
## author: Joel Dalley
## version: 2008/Nov/09
##
package Main;
{
    # Our ComplexNumber package
    use ComplexNumber;

    # Construct ComplexNumber objects $z1 and $z2
    my $z1 = new ComplexNumber(5, 12);
    my $z2 = new ComplexNumber(3, 4);

    # Print polar form of $z1 and $z2
    print "Complex number $z1 is ", $z1->polarStr(), " in polar form\n",
          "Complex number $z2 is ", $z2->polarStr(), " in polar form\n\n";

    # Demonstrate operator overloading of 
    # +, -, *, / and "", the quote operator
    print "$z1 plus $z2 = ", $z1 + $z2, "\n";
    print "$z1 minus $z2 = ", $z1 - $z2, "\n";
    print "$z1 times $z2 = ", $z1 * $z2, "\n";
    print "$z1 divided by $z2 = ", $z1 / $z2, "\n";
}

1;
